from rest_framework import viewsets, serializers
from .models import CrawlTask, ListItem, DetailItem, SubDetailItem


class CrawlTaskBasicSerializer(serializers.ModelSerializer):
    class Meta:
        model = CrawlTask
        fields = '__all__'


class ListItemBasicSerializer(serializers.ModelSerializer):
    class Meta:
        model = ListItem
        fields = '__all__'


class DetailItemBasicSerializer(serializers.ModelSerializer):
    class Meta:
        model = DetailItem
        fields = '__all__'


class SubDetailItemBasicSerializer(serializers.ModelSerializer):
    class Meta:
        model = SubDetailItem
        fields = '__all__'


class CrawlTaskViewSet(viewsets.ModelViewSet):
    queryset = CrawlTask.objects.all()
    serializer_class = CrawlTaskBasicSerializer


class ListItemViewSet(viewsets.ModelViewSet):
    queryset = ListItem.objects.all()
    serializer_class = ListItemBasicSerializer


class DetailItemViewSet(viewsets.ModelViewSet):
    queryset = DetailItem.objects.all()
    serializer_class = DetailItemBasicSerializer


class SubDetailItemViewSet(viewsets.ModelViewSet):
    queryset = SubDetailItem.objects.all()
    serializer_class = SubDetailItemBasicSerializer